<template>
  <div class="about">
    <el-row :gutter="20">
      <el-col :span="4">
        <el-card shadow="hover" class="cardView">
          <el-button type="info" @click="dialogTableVisible('img')">上传图片</el-button>
        </el-card>
        <el-dialog title="图片上传" :visible.sync="visible.img">
          <Img ref="imgName" @imgInfo="getImgInfo" />
        </el-dialog>
      </el-col>
      <el-col :span="6"><div class="grid-content bg-purple" /></el-col>
      <el-col :span="6"><div class="grid-content bg-purple" /></el-col>
      <el-col :span="6"><div class="grid-content bg-purple" /></el-col>
    </el-row>
    <div />
  </div>
</template>
<script>
import Img from '@/components/uploadImg'

export default {
  name: 'ComponentView',
  components: {
    Img
  },
  data() {
    return {
      visible: {
        img: false,
        previewImag: false
      },
      imgUrl: ''
    }
  },
  created() {
  },
  methods: {
    dialogTableVisible(type) {
      this.visible[type] = true
    },
    handleRemove(file) {
      this.$refs.uploadImg.uploadFiles = this.$refs.uploadImg.uploadFiles.filter((item) => {
        return item.uid !== file.uid
      })
    },
    handlePictureCardPreview(file) {
      this.imgUrl = file.url
      this.visible.previewImag = true
    },
    // 获取图片数据
    getImgInfo(obj) {
      console.log('获取图片数据-----', obj)
      // 清空图片数据
      // this.$refs.imgName.clearUpload()
    }
  }

}
</script>

<style scoped>
.cardView{
  margin:10px 0 0 10px;
  background: lightblue;
}
.cardView >>> .el-card__body{
  text-align: center;
}
</style>
